<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>学生列表</title>
<style type="text/css">
	td{
		text-align: center;
	}
</style>
</head>
<body>
	<table border="1" align="center" width="50%">
		<caption>学生信息列表</caption>
		<tr>
			<td colspan="4" style="text-align: left"><a href="/student?cmd=edit">新增</a></td>
		</tr>
		<tr style="background-color: orange;">
			<th>编号</th>
			<th>姓名</th>
			<th>年龄</th>
			<th>操作</th>
		</tr>
		<c:forEach var="stu" items="${list }" varStatus="num">
		<tr style="background-color: ${num.count % 2 == 0 ? 'gray' : ''};">
			<td>${pageScope.stu.id }</td>
			<td>${pageScope.stu.name }</td>
			<td>${pageScope.stu.age }</td>
			<td>
				<a href="/student?cmd=edit&id=${stu.id }">修改</a>
				<a href="/student?cmd=delete&id=${stu.id }">删除</a>
			</td>
		</tr>
		</c:forEach>
	</table>
</body>
</html>